<?php
/**
 * Netflix_Catalog Class.
 * Could be deprecated.
 * 
 * @author Armando Padilla, armando_padilla_81@yahoo.com
 * @package Zend_Service_Netflix
 */
class Netflix_Catalog {

	/**
	 * Number of Records Returned.
	 *
	 * @var unknown_type
	 */
	public $numberOfResults;
	
	/**
	 * Start Index Set by User REST call.
	 *
	 * @var unknown_type
	 */
	public $startIndex;
	
	/**
	 * Results per page.
	 *
	 * @var unknown_type
	 */
	public $resultsPerPage;

	/**
	 * Collection of Title Objects.
	 *
	 * @var unknown_type
	 */
	public $titles;
	
	
	public function __construct(){
		
		//Create an empty title set.
		$this->titles = array();
		
	}
	
	
	/**
	 * Load the catalog data from XML.
	 *
	 * @param unknown_type $simpleXmlObject
	 */
	public function loadXML($simpleXmlObject){
		
		//Set all properties
		$this->numberOfResults = (string)$simpleXmlObject->number_of_results;
		$this->startIndex      = (string)$simpleXmlObject->start_index;
		$this->resultsPerPage  = (string)$simpleXmlObject->results_per_page;
		
		//Instantiate Title Objects.
		require_once "Title.php";
		foreach($simpleXmlObject->catalog_title as $title){
			
			$Title = new Netflix_Title();
			$Title->loadXML($title);
			
			array_push($this->titles, $Title);
			
		}	
		
	}

}
?>